-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dockerize #48
base: main
Are you sure you want to change the base?
Dockerize #48
Conversation
I played around with this a little bit and pushed a couple of small tweaks to the scripts on a branch. As a Docker noob, I'd like to flesh this out a little more before deciding whether to commit to master. One basic question is: what is the intended use case for running stoken in a Docker container? Is there another project (either active, or under development) that is utilizing stoken in this configuration? Is the intention to always run stoken (alone) in its own container, or will there be other services/daemons/etc. running in the same container and (say) calling into libstoken to generate tokencodes? Adding a little context + Docker instructions to the README might be helpful. Ideally the docs would explain when/why this would come in handy, and include a short "cookbook" of commands that a user could copy&paste to get started. If you don't need
|
Agree, I suspect a flatpak or snap containerized app of stoken/stoken-gui might be more useful. |
@@ -0,0 +1,26 @@ | |||
FROM ubuntu:16.04 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These large tabs should be reduced to a single space, I have never seen a Dockerfile formatted this way.
FROM ubuntu:16.04 | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be combined into a single command with &&
.
Also clean the apt cache after installing packages. See the apt-get recommendations here.
build-essential \ | ||
git | ||
|
||
RUN git clone git://github.com/cernekee/stoken |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://
instead of git://
?
@@ -0,0 +1,26 @@ | |||
## Build container | |||
build: | |||
@bash -x scripts/build.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If build.sh
is a one-liner, just inline it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was kind of wondering if it is more common for Docker users to invoke make -C docker build
, ./docker/scripts/build.sh
, or something else.
For make -C docker run
I would assume you'll want a way to pass arguments, so that the user can at least perform basic operations like importing a new token?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly I think it's more common for Docker users to run docker commands themselves. If I saw a Dockerfile in a project, it would be logical that I can simply do
docker build -t mytagname dir
docker run -it mytagname bash
I'm not sure these make targets or helper scripts provide much value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In short, as a first step, I would probably just commit docker/Dockerfile and leave it at that. Most Docker users and tools know what to do with that.
|
||
## Run project | ||
run: | ||
@bash -x scripts/run.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, just inline the command here.
#!/bin/bash | ||
set -ex | ||
|
||
docker build -t stevemcquaid/stoken:latest . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Obviously without your user name hard coded here.
@@ -0,0 +1,4 @@ | |||
#!/bin/bash | |||
|
|||
docker run -it -v $HOME:/root stevemcquaid/stoken:latest stoken $@ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same user name issue here.
Happy to modify as needed